import { computed } from "vue";
import { useI18n } from "vue-i18n";

export default function useLocale() {
    const { locale } = useI18n();
    const currentLocale = computed(() => {
        return locale.value;
    });

    const changeLang = (value: string): void => {
        locale.value = value;
        localStorage.setItem("lang", value);
    };

    return { currentLocale, changeLang };
}
